﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:UserControls="clr-namespace:WPFEntityFrameworkTest.UserControls"
        xmlns:local="clr-namespace:WPFEntityFrameworkTest.ValueConverter"
        x:Class="WPFEntityFrameworkTest.MainWindow"
        Title="MainWindow" Height="768" Width="1024">
    <Window.Resources>
        <local:BoolToVisibilityConverter x:Key="boolToVisibility" />
        <UserControls:CategoryControl x:Key="Cat"></UserControls:CategoryControl>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="100px"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200px"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch">
            <TreeView Style="{StaticResource TreeViewMenu}">
                <TreeViewItem Style="{StaticResource TreeViewItemMenu}" x:Name="Optionen" Header="Optionen" IsSelected="True"></TreeViewItem>
                <TreeViewItem Style="{StaticResource TreeViewItemMenu}" x:Name="Personen" Header="Personen"></TreeViewItem>
                <TreeViewItem Style="{StaticResource TreeViewItemMenu}" x:Name="Gruppen" Header="Gruppen"></TreeViewItem>
            </TreeView>
        </StackPanel>
        <!-- Visibility Converter verwenden um den aktuellen Bereich auszublenden der nicht genutzt werden soll -->
        <StackPanel Grid.Column="1"  Grid.Row="1" Visibility="{Binding ElementName=Optionen, Path=IsSelected, Converter={StaticResource boolToVisibility}}">
            <UserControls:CategoryControl></UserControls:CategoryControl>
        </StackPanel>

        <StackPanel Grid.Column="1"  Grid.Row="1" Visibility="{Binding ElementName=Gruppen, Path=IsSelected, Converter={StaticResource boolToVisibility}}">
            <UserControls:GroupControl></UserControls:GroupControl>
        </StackPanel>

        <StackPanel Grid.Column="1"  Grid.Row="1" Visibility="{Binding ElementName=Personen, Path=IsSelected, Converter={StaticResource boolToVisibility}}">
            <UserControls:PersonControl></UserControls:PersonControl>
        </StackPanel>
    </Grid>
</Window>
